package com.luoling.shell;


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Description:
 * Copyright:   Copyright (c)2024
 * Company:
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2024-06-05 17:06:41
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2024-06-05     张李鑫                     1.0         1.0 Version
 */

public class CloseStream implements InvocationHandler {

    private final Shell target;

    public CloseStream(Shell target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object invoke = method.invoke(target, args);
        target.closeStreams();//关闭流
        return invoke;
    }

}